<html>
<head>
	<meta charset="utf-8">
	<title>Reflect</title>
</head>
<body>


<script>
const obj11 = {
	key1: "name1",
	key2: "name2",
};
console.log(Reflect.has(obj11, 'key1'));//true
console.log(Reflect.ownKeys(obj11));// ["key1", "key2"]
console.log(Reflect.get(obj11, 'key1'));//name1
Reflect.set(obj11, 'key1', 'val1');
console.log(Reflect.get(obj11, 'key1'));//val1

console.log(Reflect.isExtensible(obj11));
console.log(Reflect.preventExtensions(obj11));

//Reflect.getPrototypeOf方法用于读取对象的__proto__属性，对应Object.getPrototypeOf(obj)
//Reflect.setPrototypeOf(obj, newProto)
console.log(Reflect.getPrototypeOf(obj11));

//Reflect.apply(func, thisArg, args)
//Reflect.apply方法等同于Function.prototype.apply.call(func, thisArg, args)，用于绑定this对象后执行给定函数。


</script>
<script type="text/javascript">
function Car(name) {
	this.name = name;
}
Car.prototype = {
	add: function() {

	}
}
// new 的写法
const car1 = new Car('张三');

// Reflect.construct 的写法
const car2 = Reflect.construct(Car, ['张三']);
console.log(car1, car2);
</script>
</body>
</html>